package cn.luischen.service.option.impl;

import org.springframework.cache.annotation.Cacheable;
import cn.luischen.service.option.OptionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import cn.luischen.dao.OptionDao;
import cn.luischen.exception.BusinessException;
import cn.luischen.constant.ErrorConstant;
import cn.luischen.model.OptionsDomain;
import org.springframework.transaction.annotation.Transactional;

import org.powermock.reflect.Whitebox;
import org.mockito.Mock;
import static org.junit.Assert.fail;
import org.junit.runner.RunWith;
import java.util.HashMap;
import java.util.ArrayList;
import org.mockito.MockitoAnnotations;
import com.alibaba.fastjson.JSONArray;
import java.util.Map;
import org.junit.After;
import org.powermock.core.classloader.annotations.PrepareForTest;
import static org.junit.Assert.assertEquals;
import org.powermock.modules.junit4.PowerMockRunner;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import java.lang.reflect.Method;
import org.junit.rules.ExpectedException;
import org.mockito.InjectMocks;
import org.junit.Test;
import static org.junit.Assert.*;
import com.unitspirit.runtime.*;
import org.mockito.Mockito;
import java.util.List;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import org.junit.Rule;
import static org.junit.Assert.assertNotNull;
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.*;
import static org.junit.Assert.assertTrue;
import com.alibaba.fastjson.parser.ParserConfig;

/**
* The class <code>OptionServiceImplTest</code> contains tests for the class <code>{@link OptionServiceImpl}</code>.
* Copyright (c) 2020
* 
* @generatedBy UnitSpirit at 2021-09-07 17:52:03
* @version 1.0.20210903
*/

@PowerMockIgnore({ "javax.management.*" })
@RunWith(PowerMockRunner.class)
@PrepareForTest({ cn.luischen.dao.OptionDao.class, cn.luischen.model.OptionsDomain.class })
public class OptionServiceImpl_updateOptionByName_WGTest {

	@InjectMocks
	cn.luischen.service.option.impl.OptionServiceImpl unitspirit_fixture;
	@Mock
	cn.luischen.dao.OptionDao mock_OptionDao;

	@Rule
	public ExpectedException unitspirit_thrown = ExpectedException.none();

	/**
	* 测试方法初始化.
	* 
	* @throws Exception 
	*         if the initialization fails for some reason 
	*  
	* @generatedBy UnitSpirit at 2021-09-07 17:52:03
	*/
	@org.junit.Before
	public void setUp() throws Exception {
		try {
			GlobalUnitInit.init();
			MockitoAnnotations.initMocks(this);
			ParserConfig.getGlobalInstance().setAutoTypeSupport(true);
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

	/**
	* @date 2021-09-07 17:52:04
	* @see cn.luischen.service.option.impl.OptionServiceImpl#updateOptionByName
	* @category auto generate by UnitSpirit  
	* @author UnitSpirit   
	*/
	@Test
	public void test_updateOptionByName_20210722_100110_234_1_01() throws Throwable {
		//被测函数参数定义
		String String_p_0 = "allow_install";
		String String_p_1 = "";
		//成员变量设置

		//返回值定义 
		//该函数无返回值 

		cn.luischen.model.OptionsDomain mock_sub_caller_OptionsDomain4 = PowerMockito
				.mock(cn.luischen.model.OptionsDomain.class);
		String Stringmock3_0 = "allow_install";
		String Stringmock2_0 = "";
		Integer mock_result_Integer1 = 0;

		PowerMockito.whenNew(cn.luischen.model.OptionsDomain.class).withNoArguments()
				.thenReturn(mock_sub_caller_OptionsDomain4);
		PowerMockito.doNothing().when(mock_sub_caller_OptionsDomain4).setName(anyString());
		PowerMockito.doNothing().when(mock_sub_caller_OptionsDomain4).setValue(anyString());
		PowerMockito.when(mock_OptionDao.updateOptionByName(Mockito.any(cn.luischen.model.OptionsDomain.class)))
				.thenReturn(mock_result_Integer1);

		unitspirit_fixture.updateOptionByName(String_p_0, String_p_1);
		assertTrue(true);
	}

	/**
	* @date 2021-09-07 17:52:04
	* @see cn.luischen.service.option.impl.OptionServiceImpl#updateOptionByName
	* @category auto generate by UnitSpirit  
	* @author UnitSpirit   
	*/
	@Test
	public void test_updateOptionByName_20210722_100110_234_2_01() throws Throwable {
		//被测函数参数定义
		String String_p_0 = "site_title";
		String String_p_1 = "11122";
		//成员变量设置

		//返回值定义 
		//该函数无返回值 

		cn.luischen.model.OptionsDomain mock_sub_caller_OptionsDomain4 = PowerMockito
				.mock(cn.luischen.model.OptionsDomain.class);
		String Stringmock3_0 = "site_title";
		String Stringmock2_0 = "11122";
		Integer mock_result_Integer1 = 1;

		PowerMockito.whenNew(cn.luischen.model.OptionsDomain.class).withNoArguments()
				.thenReturn(mock_sub_caller_OptionsDomain4);
		PowerMockito.doNothing().when(mock_sub_caller_OptionsDomain4).setName(anyString());
		PowerMockito.doNothing().when(mock_sub_caller_OptionsDomain4).setValue(anyString());
		PowerMockito.when(mock_OptionDao.updateOptionByName(Mockito.any(cn.luischen.model.OptionsDomain.class)))
				.thenReturn(mock_result_Integer1);

		unitspirit_fixture.updateOptionByName(String_p_0, String_p_1);
		assertTrue(true);
	}

	/**
	* @date 2021-09-07 17:52:04
	* @see cn.luischen.service.option.impl.OptionServiceImpl#updateOptionByName
	* @category auto generate by UnitSpirit  
	* @author UnitSpirit   
	*/
	@Test
	public void test_updateOptionByName_20210722_100110_234_3_01() throws Throwable {
		//被测函数参数定义
		String String_p_0 = "baidu_site_verification";
		String String_p_1 = "123";
		//成员变量设置

		//返回值定义 
		//该函数无返回值 

		cn.luischen.model.OptionsDomain mock_sub_caller_OptionsDomain4 = PowerMockito
				.mock(cn.luischen.model.OptionsDomain.class);
		String Stringmock3_0 = "baidu_site_verification";
		String Stringmock2_0 = "123";
		Integer mock_result_Integer1 = 1;

		PowerMockito.whenNew(cn.luischen.model.OptionsDomain.class).withNoArguments()
				.thenReturn(mock_sub_caller_OptionsDomain4);
		PowerMockito.doNothing().when(mock_sub_caller_OptionsDomain4).setName(anyString());
		PowerMockito.doNothing().when(mock_sub_caller_OptionsDomain4).setValue(anyString());
		PowerMockito.when(mock_OptionDao.updateOptionByName(Mockito.any(cn.luischen.model.OptionsDomain.class)))
				.thenReturn(mock_result_Integer1);

		unitspirit_fixture.updateOptionByName(String_p_0, String_p_1);
		assertTrue(true);
	}

	/**
	* @date 2021-09-07 17:52:04
	* @see cn.luischen.service.option.impl.OptionServiceImpl#updateOptionByName
	* @category auto generate by UnitSpirit  
	* @author UnitSpirit   
	*/
	@Test
	public void test_updateOptionByName_20210722_100110_234_4_01() throws Throwable {
		//被测函数参数定义
		String String_p_0 = "site_description";
		String String_p_1 = "erer";
		//成员变量设置

		//返回值定义 
		//该函数无返回值 

		cn.luischen.model.OptionsDomain mock_sub_caller_OptionsDomain4 = PowerMockito
				.mock(cn.luischen.model.OptionsDomain.class);
		String Stringmock3_0 = "site_description";
		String Stringmock2_0 = "erer";
		Integer mock_result_Integer1 = 1;

		PowerMockito.whenNew(cn.luischen.model.OptionsDomain.class).withNoArguments()
				.thenReturn(mock_sub_caller_OptionsDomain4);
		PowerMockito.doNothing().when(mock_sub_caller_OptionsDomain4).setName(anyString());
		PowerMockito.doNothing().when(mock_sub_caller_OptionsDomain4).setValue(anyString());
		PowerMockito.when(mock_OptionDao.updateOptionByName(Mockito.any(cn.luischen.model.OptionsDomain.class)))
				.thenReturn(mock_result_Integer1);

		unitspirit_fixture.updateOptionByName(String_p_0, String_p_1);
		assertTrue(true);
	}

	/**
	* @date 2021-09-07 17:52:04
	* @see cn.luischen.service.option.impl.OptionServiceImpl#updateOptionByName
	* @category auto generate by UnitSpirit  
	* @author UnitSpirit   
	*/
	@Test
	public void test_updateOptionByName_20210722_100110_234_5_01() throws Throwable {
		//被测函数参数定义
		String String_p_0 = "google_site_verification";
		String String_p_1 = "111";
		//成员变量设置

		//返回值定义 
		//该函数无返回值 

		cn.luischen.model.OptionsDomain mock_sub_caller_OptionsDomain4 = PowerMockito
				.mock(cn.luischen.model.OptionsDomain.class);
		String Stringmock3_0 = "google_site_verification";
		String Stringmock2_0 = "111";
		Integer mock_result_Integer1 = 1;

		PowerMockito.whenNew(cn.luischen.model.OptionsDomain.class).withNoArguments()
				.thenReturn(mock_sub_caller_OptionsDomain4);
		PowerMockito.doNothing().when(mock_sub_caller_OptionsDomain4).setName(anyString());
		PowerMockito.doNothing().when(mock_sub_caller_OptionsDomain4).setValue(anyString());
		PowerMockito.when(mock_OptionDao.updateOptionByName(Mockito.any(cn.luischen.model.OptionsDomain.class)))
				.thenReturn(mock_result_Integer1);

		unitspirit_fixture.updateOptionByName(String_p_0, String_p_1);
		assertTrue(true);
	}

	/**
	* @date 2021-09-07 17:52:04
	* @see cn.luischen.service.option.impl.OptionServiceImpl#updateOptionByName
	* @category auto generate by UnitSpirit  
	* @author UnitSpirit   
	*/
	@Test
	public void test_updateOptionByName_20210722_100110_234_6_01() throws Throwable {
		//被测函数参数定义
		String String_p_0 = "site_record";
		String String_p_1 = "222";
		//成员变量设置

		//返回值定义 
		//该函数无返回值 

		cn.luischen.model.OptionsDomain mock_sub_caller_OptionsDomain4 = PowerMockito
				.mock(cn.luischen.model.OptionsDomain.class);
		String Stringmock3_0 = "site_record";
		String Stringmock2_0 = "222";
		Integer mock_result_Integer1 = 1;

		PowerMockito.whenNew(cn.luischen.model.OptionsDomain.class).withNoArguments()
				.thenReturn(mock_sub_caller_OptionsDomain4);
		PowerMockito.doNothing().when(mock_sub_caller_OptionsDomain4).setName(anyString());
		PowerMockito.doNothing().when(mock_sub_caller_OptionsDomain4).setValue(anyString());
		PowerMockito.when(mock_OptionDao.updateOptionByName(Mockito.any(cn.luischen.model.OptionsDomain.class)))
				.thenReturn(mock_result_Integer1);

		unitspirit_fixture.updateOptionByName(String_p_0, String_p_1);
		assertTrue(true);
	}
}
